//
//  UIBarButtonItem+Button.swift
//  czbkiosweibo5
//
//  Created by zhangping on 15/10/15.
//  Copyright © 2015年 zhangping. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    /**
    快速创建带高亮图片的BarButton
    - parameter imageName:            正常时的图片名称
    - parameter highlightedImageName: 高亮时的图片名称
    - returns: UIBarButtonItem
    */
    convenience init(imageName: String, highlightedImageName: String) {
        let button = UIButton()
        
        button.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: highlightedImageName), forState: UIControlState.Highlighted)
        button.sizeToFit()
        
        self.init(customView: button)
    }
    
/*    /**
    快速创建带高亮图片的BarButton
    - parameter imageName:            正常时的图片名称
    - parameter highlightedImageName: 高亮时的图片名称
    - returns: UIBarButtonItem
    */
    class func createBarButtonItem(imageName: String, highlightedImageName: String) -> UIBarButtonItem {
        let button = UIButton()
    
        button.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: highlightedImageName), forState: UIControlState.Highlighted)
        button.sizeToFit()
    
        return UIBarButtonItem(customView: button)
    } */
}
